<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>修改信息页面</title>
    <link rel="stylesheet" type="text/css" href="../static/admin/layui2/css/layui.css"/>
</head>
<body class="layui-layout-admin" >
        <div class="layui-anim layui-anim-scale">
            <form class="layui-form layui-form-pane" name="form1" id="form1" style="margin-top: 10px;margin-left: 10px">
                <div class="layui-form-item">
                    <label class="layui-form-label">学号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="number" id="number" lay-verify="required" class="layui-input" disabled>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" id="name" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">性别</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="gender" id="male" value="1" title="男" checked>
                        <input type="radio" name="gender" id="female" value="0" title="女">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">班级</label>
                    <div class="layui-input-inline">
                        <input type="text" name="clazz" id="clazz" lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所在学院</label>
                    <div class="layui-input-inline" lay-filter="selFilter">
                        <select name="department" id="department" lay-verify="required">
                            <option value=""></option>
                            <option value="软件学院">软件学院</option>
                            <option value="信息工程学院">信息工程学院</option>
                            <option value="水环学院">水环学院</option>
                            <option value="土建学院">土建学院</option>
                            <option value="测绘工程学院">测绘工程学院</option>
                            <option value="核工学院">核工学院</option>
                            <option value="理学院">理学院</option>
                            <option value="化生材学院">化生材学院</option>
                            <option value="地科学院">地科学院</option>
                            <option value="地控学院">地控学院</option>
                            <option value="机电学院">机电学院</option>
                            <option value="外国语学院">外国语学院</option>
                            <option value="体育学院">体育学院</option>
                            <option value="国际教育学院">国际教育学院</option>
                            <option value="经管学院">经管学院</option>
                            <option value="文法学院">文法学院</option>
                            <option value="艺术学院">艺术学院</option>
                            <option value="研究生院">研究生院</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">专业</label>
                    <div class="layui-input-inline">
                        <input type="text" name="major" id="major" lay-verify="required" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">电话</label>
                    <div class="layui-input-inline">
                        <input type="text" name="phone" id="phone" autocomplete="off" lay-verify="phone" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">邮箱</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mail" id="mail" lay-verify="email" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">政治面貌</label>
                    <div class="layui-input-inline" lay-filter="selFilter2">
                        <select name="politic" id="politic" lay-verify="required">
                            <option value=""></option>
                            <option value="群众">群众</option>
                            <option value="团员">团员</option>
                            <option value="党员">党员</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">获奖情况</label>
                    <div class="layui-input-inline">
                        <textarea name="awards" id="awards" class="layui-textarea" style="width: 400px"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline">
                        <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="demo1">修改</button>
                    </div>
                </div>
            </form>
        </div>
</div>
<script src="../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function() {
        var element = layui.element
        var form = layui.form
        layer = layui.layer
        $ = layui.jquery;

        form.render('select','selFilter');
        form.render('select','selFilter2');
        form.on('submit(demo1)',function(data){
            $.ajax({
                type:"POST",
                url:"/student/updataStudent",
                data:{
                    "number": data.field.number,
                    "name": data.field.name,
                    "gender": data.field.gender,
                    "clazz": data.field.clazz,
                    "department":data.field.department,
                    "major":data.field.major,
                    "phone":data.field.phone,
                    "mail":data.field.mail,
                    "politic":data.field.politic,
                    "awards":data.field.awards,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag) {
                        layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框,提示2秒自动消失
                        setTimeout(function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);//关闭弹出层
                            parent.location.reload();//重新加载父页面表格
                        }, 2100);
                    }else  {
                        layer.msg(res.msg,{icon:5,offset:"auto",time:2000});//提示框
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>